<template>
  <button
    class="tool-button"
    :class="buttonClass"
    @click="click"
  >
    <slot></slot>
  </button>
</template>

<script>
export default {
  props: {
    type: {
      type: String,
      default: 'default'
    }
  },
  computed: {
    buttonClass () {
      return `tool-button-${this.type}`
    }
  },
  methods: {
    click () {
      this.$emit('click')
    }
  }
}
</script>

<style lang="scss">
.tool-button{
  padding: 0 20px;
  height: 35px;
  border: none;
  outline: none;
  font-size: 14px;
  color: #fefefe;
  border-radius: 2px;
  letter-spacing: .1em;
  font-family: PingFang SC, Microsoft YaHei;
  cursor: pointer;
}
.tool-button:not(:first-child) {
  margin-left: 10px;
}
.tool-button-default{
  background: #ccc;
}
.tool-button-default:active{
  background: #bcbcbc;
}
.tool-button-primary{
  background: $theme-color;
}
.tool-button-primary:active{
  background: $theme-active-color;
}
.tool-button-primary:disabled{
  opacity: .8;
  cursor: not-allowed;
}
</style>